feat(core): add URL elicitation support (SEP-1036)#939
Open
sainathreddyb wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
feat(core): add URL elicitation support (SEP-1036)#939sainathreddyb wants to merge 1 commit intomodelcontextprotocol:mainfrom
sainathreddyb wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
c48b84e to
166c578
Compare
Add URL-type elicitation schema support allowing servers to request URL input from users during tool execution. This enables out-of-band interactions like OAuth flows, payment processing, and API key entry. Schema changes (following CONTRIBUTING.md rules): - ElicitRequest: append mode, url, elicitationId at end of record components (new optional fields default to null) - ElicitationCompleteNotification: new record implementing Notification - ErrorCodes.URL_ELICITATION_REQUIRED (-32042): new error code - METHOD_NOTIFICATION_ELICITATION_COMPLETE: new method constant Server exchange: - createElicitation validates URL mode against client capability - sendElicitationComplete sends completion notification to client Client: - elicitationCompleteConsumer() builder method on SyncSpec and AsyncSpec - Notification handler dispatches to registered consumers - Existing elicitation handler naturally receives URL mode requests Validation: - Canonical constructor enforces url/elicitationId non-null for URL mode - Builder rejects requestedSchema when mode is 'url' Backward compatible: existing form-mode callers are unaffected. Old constructors delegate to canonical constructor with null for new fields. Ref modelcontextprotocol#939
d31f97c to
869d1b3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add URL-type elicitation schema support allowing servers to request URL input from users during tool execution (SEP-1036).
Changes:
UrlElicitationSchemaandUrlElicitationResulttypes inMcpSchema.javaMcpAsyncClient,McpClient, andMcpClientFeaturesMcpAsyncServerExchangeandMcpSyncServerExchangeMotivation and Context
SEP-1036 introduces a URL elicitation type, enabling MCP servers to request a URL from the user during tool execution — for example, asking the user to provide a callback URL, a webhook endpoint, or a resource link. This complements the existing form-based elicitation with a purpose-built schema for URL input.
How Has This Been Tested?
McpSchemaTests: Serialization/deserialization round-trip tests forUrlElicitationSchemaandUrlElicitationResultMcpAsyncClientResponseHandlerTests: Client-side handler registration and dispatch for URL elicitation requestsMcpAsyncServerExchangeTests/McpSyncServerExchangeTests: Server exchange URL elicitation request/response flow./mvnw clean test— all modules green (BUILD SUCCESS)Breaking Changes
None. This is a purely additive change — new types and methods alongside existing elicitation support.
Types of changes
Checklist
Additional context
This implements the Java SDK side of SEP-1036. The schema types follow the same pattern as the existing
ElicitationSchema/ElicitationResultfor form-based elicitation, keeping the API consistent.